<?php
class LyModel extends Model{

	function init(){$this->OpenDB();}
	
	function Insert($nick,$content,$ip,$ua){
		$sql="INSERT INTO `@#__ly`(ly_nick,ly_content,ly_ip,ly_ua,ly_time)values(
		'$nick','$content','$ip','$ua',".time().")";
		return $this->db->query($sql);
	}
	
	function getLy($id=null){
		$id=intval($id);
		$slq="select * from @#__ly";
		if ($id)$slq.=" where ly_id=$id";
		$slq.=" order by ly_id desc";
		return $this->db->fetchRows($slq);
	}
	function delLy($id){
		$id=intval($id);
		$sql="delete from @#__ly where ly_id=$id";
		return $this->db->query($sql);
	}
}